﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel;

namespace Farmacie.Managers
{
    public class IncasariManager : INotifyPropertyChanged
    {
        #region Singleton

        private static IncasariManager instance;

        public static IncasariManager Instance
        {
            get
            {
                if (instance == null)
                {
                    instance = new IncasariManager();
                }

                return instance;
            }
        }

        private IncasariManager() {}

        #endregion

        private double totalIncasari = 0;

        public double TotalIncasari
        {
            get
            {
                return totalIncasari;
            }
        }

        public void AdaugaLaIncasari(double valoare)
        {
            totalIncasari += valoare;
            OnPropertyChanged("TotalIncasari");
        }

        public void ReseteazaCasa(double valoareInitiala)
        {
            totalIncasari = valoareInitiala;
        }

        #region INotifyPropertyChanged

        public event PropertyChangedEventHandler PropertyChanged;

        private void OnPropertyChanged(String info)
        {
            if (PropertyChanged != null)
            {
                PropertyChanged(this, new PropertyChangedEventArgs(info));
            }
        }

        #endregion
    }
}
